import store from 'lxsh-auth-web-pc/src/store/install'

const modulesFiles = require.context('lxsh-cer-web-pc/src/store/modules', true, /\.ts$/)
console.log("获取到的vuex配置信息为：",modulesFiles.keys())
const buildModules = modulesFiles.keys().filter(item => item.indexOf('permission') >= 0).reduce((modules, modulePath) => {
  // set './app.js' => 'app'
  debugger
  const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
  const value = modulesFiles(modulePath)

  // 注册嵌套模块 `nested/myModule`
  // store.unregisterModule(moduleName)
  store.registerModule(moduleName, value.default)
  Object.defineProperties(modules,{
    moduleName:{
      configurable:true,
      enumerable:true, //tel属性修改为可枚举
      value:value.default
    },
  })

  return modules
  // }
}, {})

export default store
